import { getMenuList } from '../../../request/api'
interface menuState {
  menulist: Array<Object>
}
const state = {
  menulist: []
}

const getters = {
  getMenu(state: menuState) {
    return state.menulist
  }
}

const mutations = {
  REQ_MENU(state: menuState, payload: any) {
    state.menulist = payload
  }
}

const actions = {
  changeMenuAction({ commit }: any) {
    getMenuList().then((res: any) => {
      commit('REQ_MENU', res.list)
    })
  }
}

export default {
  state,
  getters,
  actions,
  mutations,
  namespaced: true
}